//
//  RootViewController.m
//  Homework13_DouBan
//
//  Created by lanou3g on 15/10/14.
//  Copyright © 2015年 ChieLi. All rights reserved.
//

#import "RootViewController.h"

#import "ActivityTableViewController.h"
#import "MovieTableViewController.h"
#import "CinemaTableViewController.h"
#import "UserTableViewController.h"
#import "SKSplashIcon.h"

@interface RootViewController ()<SKSplashDelegate>
@property (strong, nonatomic) SKSplashView *splashView;
@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    ActivityTableViewController *actTVC = [[ActivityTableViewController alloc] initWithStyle:(UITableViewStylePlain)];
    UINavigationController *actNC = [[UINavigationController alloc] initWithRootViewController:actTVC];
    actNC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"活动" image:[UIImage imageNamed:@"activity.png"] tag:100];
    
    MovieTableViewController *mvTVC = [[MovieTableViewController alloc] initWithStyle:(UITableViewStylePlain)];
    UINavigationController *mvNC = [[UINavigationController alloc] initWithRootViewController:mvTVC];
    mvNC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"电影" image:[UIImage imageNamed:@"movie.png"] tag:101];
    
    CinemaTableViewController *cnmTVC = [[CinemaTableViewController alloc] initWithStyle:(UITableViewStylePlain)];
    UINavigationController *cnmNC = [[UINavigationController alloc] initWithRootViewController:cnmTVC];
    cnmNC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"影院" image:[UIImage imageNamed:@"cinema.png"] tag:102];
    
    UserTableViewController *usTVC = [[UserTableViewController alloc] initWithStyle:(UITableViewStylePlain)];
    UINavigationController *usNC = [[UINavigationController alloc] initWithRootViewController:usTVC];
    usNC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"user.png"] tag:103];
    
    
    self.viewControllers = @[actNC, mvNC, cnmNC, usNC];
    

    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"bg_nav"] forBarMetrics:(UIBarMetricsDefault)];
     [self twitterSplash];
    
}


- (void) twitterSplash
{
    //Setting the background
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.frame];
    imageView.image = [UIImage imageNamed:@"twitter background.png"];
    [self.view addSubview:imageView];
    //Twitter style splash
    SKSplashIcon *twitterSplashIcon = [[SKSplashIcon alloc] initWithImage:[UIImage imageNamed:@"1231.png"] animationType:SKIconAnimationTypeBounce];
    UIColor *twitterColor = [UIColor colorWithRed:0.25098 green:0.6 blue:1.0 alpha:1.0];
    _splashView = [[SKSplashView alloc] initWithSplashIcon:twitterSplashIcon backgroundColor:twitterColor animationType:SKSplashAnimationTypeNone];
    _splashView.delegate = self; //Optional -> if you want to receive updates on animation beginning/end
    _splashView.animationDuration = 2; //Optional -> set animation duration. Default: 1s
    [self.view addSubview:_splashView];
    [_splashView startAnimation];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
